﻿@model ProductReviewOverviewModel
@{
    var ratingPercent = 0;
    var noReviews = Model.TotalReviews == 0;
    if (!noReviews)
    {
        ratingPercent = ((Model.RatingSum * 100) / Model.TotalReviews) / 5;
    }
}
@if (Model.AllowCustomerReviews)
{
    <div class="product-reviews-overview">
        <div class="product-review-box">
            <div class="rating">
                <div style="width: @(ratingPercent)%">
                </div>
            </div>
        </div>

        @if (Model.TotalReviews > 0)
        {
            <div class="product-review-links">
                <a href="#productreviews">@Model.TotalReviews
                    @T("Reviews.Overview.Reviews")</a>
            </div>
        }

        @if (Model.CanAddNewReview && Model.CanCurrentCustomerLeaveReview)
        {
            <div class="product-review-links add-review @(noReviews ? "product-no-reviews" : "")">
                <a href="#addreview" class="">@T(noReviews ? "Reviews.Overview.First" : "Reviews.Overview.AddNew")</a>
            </div>
        }
    </div>
}